package com.sk.tools.excel.meta;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.sk.tools.excel.meta.model.ExcelMeta;

import javax.naming.ConfigurationException;
import java.io.IOException;
import java.net.URL;

public class MetaConfigurationParser {

    private ObjectMapper mapper = new ObjectMapper();

    private URL defaultCfgResource = this.getClass().getResource("/config.json");

    public ExcelMeta parse() throws ConfigurationException {
        try {
            return mapper.readValue(defaultCfgResource, ExcelMeta.class);
        } catch (IOException e) {
            e.printStackTrace();
            throw new ConfigurationException("no configuration json file present");
        }
    }


}
